// pages/classtype/classtype.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    til:[
      {id:0,tile:'短剧'},
      {id:1,tile:'周边'},
      {id:2,tile:'徽章'},
      {id:3,tile:'陪玩'},
      {id:4,tile:'全部'},
    ],
    commodity:[],
    commodityAll:[
      {id:1,name:'新季节先知道',hot:'——小光新报道',src:'/static/image/陪3.jpeg',classid:3},
      {id:2,name:'红尘听雨落愿君世..',hot:'预热',src:'/static/image/陪3.jpeg',classid:0},
      {id:3,name:'xingchen陪玩团',hot:'预热',src:'/static/image/陪3.jpeg'  ,classid:3},
      {id:4,name:'HAS陪玩团',hot:'预热',src:'/static/image/陪4.jpeg' ,classid:3},
      {id:5,name:'Hohsino陪玩团',hot:'预热',src:'/static/image/陪5.jpeg',classid:3},
      {id:6,name:'Sky知己NFC功能',hot:'预热',src:'/static/image/陪3.jpeg',classid:2},
      {id:7,name:'2022新款光遇徽',hot:'预热',src:'/static/image/陪3.jpeg',classid:2},
      {id:8,name:'光遇周边新款',hot:'预热',src:'/static/image/陪5.jpeg',classid:1},
      {id:9,name:'光遇周边sk',hot:'预热',src:'/static/image/陪4.jpeg',classid:1},
      {id:10,name:'光遇周边抱',hot:'预热',src:'/static/image/陪5.jpeg',classid:1},
    ],


  },
  search(e){
    var id = e.currentTarget.id
    var arr = this.data.commodityAll
    var arrs = []
    for(var i=0;i<arr.length;i++){
      if(arr[i].classid == id){
        arrs.push(arr[i])
      }
      if(arr[i].classid == 6){
        arrs.push(arr)
      }
    } 
    this.setData({
      commodity:arrs
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})